home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Utilities / DVIM72-Mac 1.9.6 / source / Maximize_resolution.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-14  |  1.4 KB  |  54 lines  |  [TEXT/R*ch]

  1. #include <PrintTraps.h>
  2. #include "mac-specific.h"
  3.  
  4. void Maximize_resolution( void );
  5. void Reset_resolution( void );
  6.  
  7.  
  8. void Maximize_resolution( void )
  9. {
  10.     TSetRslBlk     set_res_block;
  11.     TGetRslBlk    get_res_block;
  12.     short        best_res;
  13.     register short        i;
  14.     
  15.     get_res_block.iOpCode = getRslDataOp;
  16.     PrGeneral( (Ptr) &get_res_block );
  17.     if ( (PrError() != noErr) || (get_res_block.iError != noErr) )
  18.     {
  19.         Show_error( "The maximum resolution setting will not work "
  20.         " for this printer driver." );
  21.         return;
  22.     }
  23.     best_res = 0;
  24.     for (i = 0; i < get_res_block.iRslRecCnt; i++)
  25.         if ( (get_res_block.rgRslRec[i].iXRsl ==
  26.             get_res_block.rgRslRec[i].iYRsl) &&
  27.             (get_res_block.rgRslRec[i].iXRsl > best_res) )
  28.             best_res = get_res_block.rgRslRec[i].iXRsl;
  29.     if (best_res > 0)
  30.     {
  31.         set_res_block.iOpCode = setRslOp;
  32.         set_res_block.hPrint = g_print_rec_h;
  33.         set_res_block.iXRsl = best_res;
  34.         set_res_block.iYRsl = best_res;
  35.         PrGeneral( (Ptr) &set_res_block ); /* set device resolution */
  36.         if ( (PrError() != noErr) || (set_res_block.iError != noErr) )
  37.         {
  38.             Show_error( "The maximum resolution setting will not work "
  39.             " for this printer driver." );
  40.         }
  41.     }
  42. }
  43.  
  44.  
  45. void Reset_resolution( void )
  46. {
  47.     TSetRslBlk     set_res_block;
  48.     
  49.     set_res_block.iOpCode = setRslOp;
  50.     set_res_block.hPrint = g_print_rec_h;
  51.     set_res_block.iXRsl = 0;
  52.     set_res_block.iYRsl = 0;
  53.     PrGeneral( (Ptr) &set_res_block ); /* set device resolution */
  54. }